package com.webactus.appli;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;

public class ActusDetails extends Activity {
	WebView mWebView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.displayactus);
		
		Intent intent = getIntent();
		Bundle extras = intent.getExtras();
		final String description = (String)extras.get("description");
		
		TextView tv = (TextView) findViewById(R.id.details_actus);
		tv.setText(description);
		
		Button backButton = (Button) findViewById(R.id.backbutton);
		backButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		
		Button backButton2 = (Button) findViewById(R.id.backbutton2);
		backButton2.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		
		Button webButton = (Button) findViewById(R.id.webbutton);
		webButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getIntent().getExtras().getString("url")));
				startActivity(intent);
			}
		});
		
		Button shareButton = (Button) findViewById(R.id.share);
		shareButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				final Intent messIntent = new Intent(Intent.ACTION_SEND);
				messIntent.setType("text/plain");
				messIntent.putExtra(Intent.EXTRA_TEXT, description);
				ActusDetails.this.startActivity(Intent.createChooser(messIntent,"Partager avec ..."));
			}
		});
	}
	
	
}
